package com.book.oauth.server.role.hystrix;

import com.book.common.result.RestResponse;
import com.book.common.result.PageInfo;
import com.book.oauth.server.role.dto.RoleDto;
import com.book.oauth.server.role.vo.RoleVo;
import com.book.oauth.server.role.hystrix.impl.RoleHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
/**
 * Description：角色 Hystrix
 * @Author： leo
 * @CreateDate： 2020-12-31
 * @Email： leo.xiong@suyun360.com
 * Version: 1.0
 */
@FeignClient(value = "oauth-server", fallbackFactory = RoleHystrixImpl.class)
public interface IRoleHystrix {
    /**
     * 根据ID获取角色信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/server/role/{id}", consumes = "application/json")
    RestResponse<RoleVo> get(@PathVariable(value = "id") String id);

    /**
     * 查询角色信息
     *
     * @param roleDto
     * @return
     */
    @PostMapping(value = "/server/role/list", consumes = "application/json")
    RestResponse<List<RoleVo>> list(@RequestBody RoleDto roleDto);

    /**
     * 查询角色信息
     *
     * @param roleDto
     * @return
     */
    @PostMapping(value = "/server/role/page/list", consumes = "application/json")
    RestResponse<PageInfo<RoleVo>> pageList(@RequestBody RoleDto roleDto);

    /**
     * 新增角色信息
     *
     * @param roleDto
     * @return
     */
    @PostMapping(value = "/server/role/save", consumes = "application/json")
    RestResponse<String> save(@RequestBody RoleDto roleDto);

    /**
     * 修改角色信息
     *
     * @param roleDto
     * @return
     */
    @PutMapping(value = "/server/role/update", consumes = "application/json")
    RestResponse<String> update(@RequestBody RoleDto roleDto);

    /**
     * 删除角色信息
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/server/role/delete/{id}", consumes = "application/json")
    RestResponse<String> delete(@PathVariable(value = "id") String id);

    /**
     * 导出角色模板信息
     *
     * @return
     */
    @PostMapping(value = "/server/role/export/template", consumes = "application/json")
    RestResponse<String> exportTemplate();

    /**
     * 导出角色信息
     *
     * @param roleDto
     * @return
     */
    @PostMapping(value = "/server/role/export/excel", consumes = "application/json")
    RestResponse<String> exportExcel(@RequestBody RoleDto roleDto);

    /**
     * 导入角色信息
     *
     * @param filePath
     * @return
     */
    @PostMapping(value = "/server/role/import/excel", consumes = "application/json")
    RestResponse<String> importExcel(@RequestParam(value = "filePath") String filePath);

}
